package com.jingyanzi.privilege.util;

import java.util.function.Function;

public class FunctionTest implements Function<Integer, Function<Integer, Integer>> {

	public static void main(String[] args) {
		FunctionTest functionTest = new FunctionTest();
        System.out.println(functionTest.compute1(5,i -> i * 2,i -> i * i));//50
        System.out.println(functionTest.compute2(5,i -> i * 2,i -> i * i));//100
	}
	
	public int compute1(int i, Function<Integer,Integer> after,Function<Integer,Integer> before){
        return after.compose(before).apply(i);
    }

    public int compute2(int i, Function<Integer,Integer> before,Function<Integer,Integer> after){
        return before.andThen(after).apply(i);
    }

	@Override
	public Function<Integer, Integer> apply(Integer t) {
		
		return null;
	}


}
